package com.watson.loadclass;

import com.sun.jmx.remote.internal.ArrayQueue;

import java.net.URL;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @program: mytest
 * @description:
 * @author: zhangpeng348@jd.com
 * @date: 2019-07-17 17:28
 **/
public class ClassLoaderTest {

    public static void main(String[] args) {
        ConcurrentHashMap concurrentHashMap;
        ArrayBlockingQueue arrayBlockingQueue;
        ArrayQueue arrayQueue;
        URL[] urls = sun.misc.Launcher.getBootstrapClassPath().getURLs();
        for(URL url : urls){
            System.out.println(url.toExternalForm());
        }
        ClassLoaderTest test = new ClassLoaderTest();
        test.listTest(null);
        ReentrantLock reentrantLock;
    }

    public void listTest(Integer[] array) {

        int[] a = new int[500];
        for(int i=0; i<a.length-1; i++) {
            a[i] = i+1;
        }
        a[a.length-1] = 0;
        int index = 0;
        int before = 0;
        int countThree = 0;
        while(a[index] != index) {
            countThree++;
            if(countThree== 3) {
                countThree= 0;
                a[before] = a[index];
            }
            before = index;
            index = a[index];
        }

        System.out.println(a[index]);

    }

}
